﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HyperPin_Database_Editor
{
    public partial class HPAttractModeSettings : HPSettingsPanel
    {
        static string iniActive = "Active";
        static string iniTime = "Time";
        static string iniMaxSpinTime = "MaxSpinTime";

        public HPAttractModeSettings()
        {
            InitializeComponent();
        }

        protected void updateOptionalControls()
        {
            labelTime.Enabled = checkActive.Checked;
            numericTime.Enabled = checkActive.Checked;

            labelMaxSpinTime.Enabled = checkActive.Checked;
            numericMaxSpinTime.Enabled = checkActive.Checked;
        }

        public override void doLoadSettings()
        {
            checkActive.Checked = readSettingBool(iniActive, false);
            numericTime.Value = readSettingDecimal(iniTime, 10);
            numericMaxSpinTime.Value = readSettingDecimal(iniMaxSpinTime, 60);

            updateOptionalControls();
        }

        public override void doSaveSettings()
        {
            writeSettingBool(iniActive, checkActive.Checked);
            writeSettingInt(iniTime, (int)numericTime.Value);
            writeSettingInt(iniMaxSpinTime, (int)numericMaxSpinTime.Value);
        }

        private void checkActive_CheckedChanged(object sender, EventArgs e)
        {
            updateOptionalControls();
        }
    }
}
